package com.ai.demo.service;


import org.springframework.ai.chat.client.ChatClient;
import org.springframework.ai.chat.client.advisor.SimpleLoggerAdvisor;
import org.springframework.ai.openai.OpenAiChatModel;
import org.springframework.ai.openai.OpenAiChatOptions;
import org.springframework.ai.openai.api.OpenAiApi;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class MultiModelService {

    @Autowired
    private OpenAiChatModel baseChatModel;

    @Autowired
    private OpenAiApi baseOpenAiApi;


    public String multiClientFlow(String prompt) {
        OpenAiChatModel openAiChatModel = baseChatModel.mutate()
                .openAiApi(baseOpenAiApi)
                .defaultOptions(OpenAiChatOptions.builder().model("deepseek-chat").temperature(0.7).build())
                .build();
        return ChatClient.builder(openAiChatModel).build().prompt(prompt)
                .advisors(new SimpleLoggerAdvisor())
                .call().content();
    }


}
